import { saveTpl } from '@/api/modules/lcd/template';
import { stageConfig } from '../../data/stage';
import { message } from 'ant-design-vue';

export const previewImageSrc = ref();
/**
 * @description: 下发保存
 */
export const send = async (immediately = false) => {
  const params = {
    stage: stageConfig.value,
    templateList: [],
    lcd: stageConfig.value.lcd,
  };

  const { data } = await saveTpl(params, immediately);
  if (data.code === 200) {
    const id = data.data.templateId || data.data.componentId;
    stageConfig.value.id = id;
    message.success(data.msg);
  }
};
